package com.yonyou.cyxdms.basedata.service.service.code;


import com.yonyou.cyxdms.basedata.client.dto.code.CodeDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE,imports = com.yonyou.cyxdms.basedata.service.util.ConverterUtil.class)
public interface CodeConverter {

    CodeConverter M = Mappers.getMapper(CodeConverter.class);

    @Mappings({
            @Mapping(expression = "java(ConverterUtil.getUserName(dto.getUpdatedBy()))", target = "updatedName")
    })
    CodeDTO toDto(CodeDTO dto);

    List<CodeDTO> toDtoList(List<CodeDTO> dtos);

}
